package main

import (
	"booknote/controy"
	"booknote/service"
	"fmt"
	"log"
	"net/http"
)

func main() {
	fmt.Println("---jojo-main---")
	controy.Hello()
	controy.Query()
	controy.World()
	service.Servicetest()
	service.Openmysql()
	allbook := service.Openmysql()
	fmt.Println(allbook)

	for idx, _ := range allbook {
		fmt.Println("---jo", allbook[idx].BookName, allbook[idx].Author, allbook[idx].UserId, allbook[idx].Summary, "jo---")
	}

	http.HandleFunc("/hello", controy.SayhelloName) //设置访问的路由
	http.HandleFunc("/parant", controy.Testparant)  //测试带参数的请求
	http.HandleFunc("/json", controy.Testjson)      //测试带参数的请求

	err := http.ListenAndServe(":9090", nil) //设置监听的端口
	if err != nil {
		log.Fatal("ListenAndServe: ", err)
	}
}
